/*页面 全屏-添加*/
function o2o_edit(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

/*添加或者编辑缩小的屏幕*/
function o2o_s_edit(title,url,w,h){
	layer_show(title,url,w,h);
}
/*-删除*/
function o2o_del(url){
	
	layer.confirm('确认要删除吗？',function(index){
		window.location.href=url;
	});
}

$(".listorder input").blur(function(){
	//编写我们的抛出逻辑
	//获取主键id
	var id=$(this).attr('attr-id');
	var listorder=$(this).val();
	var postData={
		id:id,
		listorder:listorder
	};
	var url=SCOPE.listorder_url;
	$.ajax({
			url:url,
			type:'post',
			dataType:'json',
			data:postData,
			success:function(data){
				if(data.code==1){
					location.href=data.data;
				}
				
				
			}
		});
});

//城市相关二级城市

$(document).on('change','.cityId',function(){
	//编写我们的抛出逻辑
	//获取主键id
	var city_id=$(this).val();
	var postData={
		id:city_id,
	};
	var url=SCOPE.city_url;
	//alert(url)
	$.ajax({
			url:url,
			type:'post',
			dataType:'json',
			data:postData,
			success:function(data){
				if(data.status==1){
					result=data.data;
					var city_html='';
					$(result).each(function(i){
						city_html+="<option value='"+this.id+"'>"+this.name+"</option>"
					});
					$('.se_city_id').html(city_html);
				}else if(data.status==0){
					$('.se_city_id').html('<option value="0">--请选择--</option>');
					//alert(data.message);return;
				}
				
				
			}
		});
});
//分类相关二级

$(document).on('change','.categoryId',function(){
	//编写我们的抛出逻辑
	//获取主键id
	var cate_id=$(this).val();
	var postData={
		id:cate_id,
	};
	var url=SCOPE.category_url;
	//alert(url)
	$.ajax({
			url:url,
			type:'post',
			dataType:'json',
			data:postData,
			success:function(data){
				if(data.status==1){
					console.log(data)
					result=data.data;
					var category_html='';
					$(result).each(function(i){
						category_html+="<input type='checkbox' name='se_category_id[]' id='checkbox-moban' value='"+this.id+"'>"+this.name+"<label for='checkbox-moban'>&nbsp;</label>";
					});
					$('.se_category_id').html(category_html);
				}else if(data.status==0){
					$('.se_category_id').html('');
					//alert(data.message);return;
				}
				
				
			}
		});
});